This patch circumvents an apparent bug in pkgconf 1.9 that prevents
building the OpenWrt Vala package. For a discussion of this, see:

https://github.com/openwrt/packages/issues/21359

The pkgconf bug seems similar to the one discussed here:

https://github.com/pkgconf/pkgconf/issues/268

--- a/configure
+++ b/configure
@@ -13598,11 +13598,11 @@ if test -n "$GLIB_CFLAGS"; then
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED gobject-2.0 >= \$GLIB_REQUIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED") 2>&5
+  ($PKG_CONFIG --exists --print-errors "gobject-2.0 >= $GLIB_REQUIRED glib-2.0 >= $GLIB_REQUIRED") 2>&5
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>/dev/null`
+  pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "gobject-2.0 >= $GLIB_REQUIRED glib-2.0 >= $GLIB_REQUIRED" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -13615,11 +13615,11 @@ if test -n "$GLIB_LIBS"; then
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED gobject-2.0 >= \$GLIB_REQUIRED\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED") 2>&5
+  ($PKG_CONFIG --exists --print-errors "gobject-2.0 >= $GLIB_REQUIRED glib-2.0 >= $GLIB_REQUIRED") 2>&5
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>/dev/null`
+  pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "gobject-2.0 >= $GLIB_REQUIRED glib-2.0 >= $GLIB_REQUIRED" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -13640,9 +13640,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>&1`
+	        GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gobject-2.0 >= $GLIB_REQUIRED glib-2.0 >= $GLIB_REQUIRED" 2>&1`
         else
-	        GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED gobject-2.0 >= $GLIB_REQUIRED" 2>&1`
+	        GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gobject-2.0 >= $GLIB_REQUIRED glib-2.0 >= $GLIB_REQUIRED" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$GLIB_PKG_ERRORS" >&5
--- a/gobject-introspection/Makefile.in
+++ b/gobject-introspection/Makefile.in
@@ -383,8 +383,8 @@ libgidl_la_SOURCES = \
 	$(NULL)
 
 libgidl_la_LIBADD = \
-	$(GLIB_LIBS) \
 	$(GMODULE_LIBS) \
+	$(GLIB_LIBS) \
 	$(NULL)
 
 BUILT_SOURCES = scannerparser.h
@@ -400,8 +400,8 @@ gen_introspect_SOURCES = \
 	$(NULL)
 
 gen_introspect_LDADD = \
-	$(GLIB_LIBS) \
 	$(GMODULE_LIBS) \
+	$(GLIB_LIBS) \
 	libgidl.la \
 	$(NULL)
 
